<%- include ../public/page_header.html %>


    <!-- 引入分页插件 -->

    <script src="/public/admin/js/jqPaginator.js"></script>


    <div class="panel panel-default">              
            <div class="panel-heading clear">
                    <span>网站导航</span> <a href="/admin/nav/add" class="btn btn-primary fr">增加导航</a>
             </div>
            <div class="panel-body">
    <!--
        列表展示
    -->
            <div class="table-responsive">
                    <table class="table table-bordered">
                            <thead>
                            <tr class="th">
                                <th>分类名称</th>
                                <th>关联商品</th>                                
                                <th>跳转地址</th> 
                                <th>位置</th> 
                                <th class="text-center">排序</th> 
                                <th class="text-center">状态</th>                                           
                            
                                <th class="text-center">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                                    <%for(var i=0;i<list.length;i++){%>
                                            <tr>
                                                    <td><%=list[i].title%></td>  
                                                    
                                                    
                                                    <td><%=list[i].relation%></td>

                                                    <td><%=list[i].link%></td>


                                                    <td>

                                                      

                                                        <%if(list[i].position==1){%>

                                                        顶部

                                                        <%}else if(list[i].position==2){%>
                                                        中间

                                                        <%}else{%>
                                                          底部
                                                        <%}%>


                                                
                                                    </td>
                                                   
            
                                                    <td class="text-center"><span onclick="app.editNum(this,'Nav','sort','<%=list[i]._id%>')"><%=list[i].sort%></span></td>
                                                    <td class="text-center">
            
                                                        <%if(list[i].status==1){%>            
                                                                <img src="/public/admin/images/yes.gif" onclick="app.changeStatus(this,'Nav','status','<%=list[i]._id%>')" />
            
                                                        <%}else{%>
                                                                <img src="/public/admin/images/no.gif" onclick="app.changeStatus(this,'Nav','status','<%=list[i]._id%>')" />
                                                        <%}%>
            
                                                    </td>                                                                    
                                                    <td class="text-center">　<a href="/admin/nav/edit?id=<%=list[i]._id%>">修改</a>　<a class="delete" href="/admin/delete?model=Nav&id=<%=list[i]._id%>">删除</a></td>
                                                </tr>
            
                                    <%}%>
                                
                            </tbody>
                        </table>

                   <div id="page" class="pagination fr"></div>
            </div>
        </div>
    </div>

    <script>
            
            $('#page').jqPaginator({
                totalPages: <%=totalPages%>,
                visiblePages: 8,
                currentPage:  <%=page%>,
                onPageChange: function (num, type) {
                    console.log('当前第' + num + '页',type);

                    if(type=='change'){

                    location.href="/admin/nav?page="+num;
                    }
                }
            });
        
   </script>
</body>
</html>